package io.kimmking.rpcfx.context;

import java.util.HashMap;

/**
 * 上下文
 * @author lfy
 */
public class RpcfxContext {

    static ThreadLocal<HashMap<String,String>> contextHolder = ThreadLocal.withInitial(HashMap::new);

    public static  void put(String key, String v){
        HashMap<String, String> hashMap = contextHolder.get();
        hashMap.put(key,v);
    }
    public static HashMap<String,String> getAll(){
        return contextHolder.get();
    }

    public static String  get(String key){
        return contextHolder.get().get(key);
    }
    public static  void clean(){
        contextHolder.remove();
    }
}
